<template>
	<view class="container">
		<view class="r1">
			<text class="text_local">当前佣金：</text>
			<text class="text_money">2.00元</text>
		</view>
		<view class="r2">
			<button class="btn btn_local" @click="testPay">提现到零钱</button>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {

		}
	},
	methods: {
		testPay() {
			if (wx.canIUse('requestMerchantTransfer')) {
				this.$u.api.testPay().then((res) => {
					console.log(res)
					wx.requestMerchantTransfer({
						mchId: '1522447861',
						appId: 'wx9b40cb2f73a3a04e',
						package: res.data.package_info,
						success: (res) => {
							// res.err_msg将在页面展示成功后返回应用时返回ok，并不代表付款成功
							console.log('success:', res);
						},
						fail: (res) => {
							console.log('fail:', res);
						},
					});
				})
			} else {
				wx.showModal({
					content: '你的微信版本过低，请更新至最新版本。',
					showCancel: false,
				});
			}
		}
	}
}
</script>

<style lang="scss" scoped>
.container {
	margin-top: 100rpx;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;

	padding: 40rpx;

	.r1 {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: center;

		.text_local {
			font-style: normal;
			font-weight: 400;
			font-size: 32rpx;
			line-height: 38px;
			color: #000000;
		}

		.text_money {
			font-weight: 600;
			font-size: 40rpx;
			line-height: 48rpx;
			color: #D52525;
		}
	}

	.r2 {
		margin-top: 60rpx;
		.btn_local {
			width: 292px;
			height: 47px;

			display: flex;
			align-items: center;
			justify-content: center;

			background: #6B5FED;
			border-radius: 24rpx;

			font-style: normal;
			font-weight: 400;
			font-size: 36rpx;
			line-height: 50rpx;

			color: #FFFFFF;


		}
	}
}
</style>
